package ajaxjs.js;

import java.util.Map;

import sun.org.mozilla.javascript.internal.NativeArray;
import sun.org.mozilla.javascript.internal.NativeObject;

/**
 * 新建一个 js mapper 专用于 json 转换，以免影响 配置 js runtime
 * @author sp42
 *
 */
public class Mapper{
	private static Java_Js_Mapper js = new SimpleJsEngine();

	public static Map<String, Object> NativeObject2Hash(String js_code) {
		return js.NativeObject2Hash(js_code);
	}

	public static Map<String, Object> NativeObject2Hash(Object obj) {
		return js.NativeObject2Hash(obj);
	}


	public static Map<String, Object> NativeObject2Hash(NativeObject obj) {
		return js.NativeObject2Hash(obj);
	}


	public static Map<String, Object>[] NativeArray2Map(String js_code) {
		return js.NativeArray2Map(js_code);
	}


	public static Map<String, Object>[] NativeArray2Map(NativeArray nativeArr) {
		return js.NativeArray2Map(nativeArr);
	}


	public static Map<String, Object>[] NativeArray2Map(Object obj) {
		return js.NativeArray2Map(obj);
	}
}
